package com.tong.ipprint.config;

import com.tong.ipprint.interceptor.IpPrintInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: tong
 * @Date: 2024/07/28/17:05
 * @Description:
 */
@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(ipPrintInterceptor())
                .addPathPatterns("/**");
    }

    @Bean
    public IpPrintInterceptor ipPrintInterceptor(){
        return new IpPrintInterceptor();
    }
}
